<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="/layui-v2.6.4/css/layui.css" rel="stylesheet">
    <script src="/layui/layui.js"></script>
    <script src="/layui/jquery.min.js"></script>
    <script src="/layui/axios.min.js"></script>
    <script src="/layui/vue.min.js"></script>
</head>
<body>
<div id="approveView" style="padding: 20px 20px;">
  <form class="layui-form">
    <input id="id" name="id" hidden>
    <input id="casesStatus" name="casesStatus" hidden>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">案情分析<span style="color: red">*</span></label>
      <div class="layui-input-block">
        <textarea class="layui-textarea layui-hide" name="casesAnalysis" id="casesAnalysis"></textarea>
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">案情评析<span style="color: red">*</span></label>
      <div class="layui-input-block">
        <textarea class="layui-textarea layui-hide" name="casesCommentAnalysis" id="casesCommentAnalysis"></textarea>
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">案情结果<span style="color: red">*</span></label>
      <div class="layui-input-block">
        <textarea class="layui-textarea layui-hide" name="casesResult" id="casesResult"></textarea>
      </div>
    </div>
    <div class="layui-form-item layui-form-text">
      <label class="layui-form-label">相关法规<span style="color: red">*</span></label>
      <div class="layui-input-block">
        <textarea class="layui-textarea layui-hide" name="casesStatute" id="casesStatute"></textarea>
      </div>
    </div>
    <div style="text-align: center">
      <button class="layui-btn layui-btn-primary" type="button" lay-submit lay-filter="approve">确认审批案件</button>
    </div >
  </form>
</div>
</body>
<script>
  layui.use(['form','layedit'],function () {
    var form = layui.form,
        layedit = layui.layedit;

    layedit.set({
      uploadImage: {
        url: '/uploadLayEdit' //接口url
      }
    });

    var url = window.location.href;

    var cId = url.split('?')[1].split('=')[1]

    $("#id").val(cId);

    var casesAnalysis = layedit.build('casesAnalysis')
    var casesCommentAnalysis = layedit.build('casesCommentAnalysis')
    var casesResult = layedit.build('casesResult')
    var casesStatute = layedit.build('casesStatute')

    form.on('submit(approve)',function (data) {
        layedit.sync(casesAnalysis);
        layedit.sync(casesCommentAnalysis);
        layedit.sync(casesResult);
        layedit.sync(casesStatute);
        data.field.casesAnalysis = $("#casesAnalysis").val();
        data.field.casesCommentAnalysis = $("#casesCommentAnalysis").val();
        data.field.casesResult = $("#casesResult").val();
        data.field.casesStatute = $("#casesStatute").val();
        data.field.casesStatus = '案件已审结';
        axios.post('/end/cases/update',data.field).then(res => {
            layer.msg(res.data.msg);
        })
        return false;
    })


  })
</script>
</html>
